
let requrl = '/news/1000/222/aa'
// let url = '/news/:nid/:sid/aa'
let url = '/news/(.+)/(.+)/aa'

let arr = ['nid', 'sid']
let dataarr = requrl.match(url).slice(1)
let params = {}
arr.forEach((item, index) => {
  params[item] = dataarr[index]
})
console.log(params)
// req.params = params

/* console.log(new RegExp(url).test(requrl))
console.log(RegExp.$1)
console.log(RegExp.$2) */

// [ '/:nid', '/:sid' ]
/* let preg = /\/(:\w+)/g
let arr = []
url.replace(preg, (match, a1) => {
  console.log(match, a1)
  arr.push(a1.slice(1))
})
console.log(arr) */





